<template>
    <div>
        <elm-page-lr width="300px">
            <template #left>
                <elm-page-tb :splite="false">
                    <template #top>
                        <el-input placeholder="请查询输入内容" prefix-icon='el-icon-search' size="mini" v-model="filterText" @change="treebinding()" style="width:100%;"></el-input>
                    </template>
                    <elm-table-tree url="/system/org/GetTree" :post-data="{ name:filterText }" :show-header="false" style="user-select:none;"
                                    @row-click="rowClick" :unshift="{ id: null, name: '全部' }" :default-expand-all="true" height="100%" :page-size="9999">
                        <el-table-column>
                            <template v-slot="scope">
                                <template v-if="scope.row.children">
                                    <i class="el-icon-folder-opened" style="color:#0094ff;"></i>
                                </template>
                                <template v-else>
                                    <i class="el-icon-tickets" style="color:#0094ff;"></i>
                                </template>
                                {{scope.row.name}}
                            </template>
                        </el-table-column>
                    </elm-table-tree>
                </elm-page-tb>
            </template>
            <elm-page-tb>
                <template #top>
                    <el-input placeholder="请查询输入内容" size="mini" prefix-icon='el-icon-search' style="width:250px;" v-model="postData.name" clearable></el-input>
                    <right>
                        <el-button-group>
                            <el-button icon="el-icon-search" size="mini" @click="tablebinding()">查询</el-button>
                            <elm-open-button url="user_edit" title="新增" width="600" height="500">新增</elm-open-button>
                        </el-button-group>
                    </right>
                </template>
                <elm-table url="/system/user/GetData" :post-data="postData">
                  <el-table-column prop="emp_code" label="员工号"align="center"></el-table-column>
                    <el-table-column prop="nick_name" label="用户昵称"align="center"></el-table-column>
                    <el-table-column prop="user_name" label="用户账号"align="center" width="200">
                      <template v-slot="scope">
                      {{scope.row.user_name +"."+elm.info.tenant}}
                      </template>
                    </el-table-column>
                    <el-table-column prop="sex" label="性别"align="center"></el-table-column>
                    <el-table-column prop="phonenumber" label="联系电话" align="center"></el-table-column>
                    <el-table-column prop="email" label="邮箱"></el-table-column>
                    <el-table-column prop="remark" label="备注"></el-table-column>
                    <el-table-column prop="status" label="状态" align="center"></el-table-column>
                    <el-table-column fixed="right" label="操作" width="180px" align="center">
                        <template v-slot="scope">
                            <elm-open-button url="user_edit" title="编辑" width="600" height="500" :data="{ model: scope.row }" type="text">编辑</elm-open-button>
                            <elm-open-button url="user_role" title="分配角色" width="710" height="450" :data="{ id: scope.row.id  }" type="text">分配角色</elm-open-button>
                            <elm-delete-button  type="text" size="mini" url="/system/user/Delete" :data="{ id: scope.row.id }">删除</elm-delete-button>
                        </template>
                    </el-table-column>
                </elm-table>
            </elm-page-tb>
        </elm-page-lr>
    </div>

</template>

<script>
    export default {
        extends: elmVueBase,
        data() {
            return {
                filterText: '',
                postData: { org: null, name: null }
            }
        },
        created() {
        },
        methods: {
            rowClick(row) {
                this.postData.org = row.id;
                this.tablebinding();
            }
        }
    }
</script>

<style scoped>
</style>